// 导入模块
const fs = require('fs'),
    http = require('http'),
    ejs = require('ejs');
// 创建服务器
const server = http.createServer((req, res) => {
    // 获取请求路径
    let url = req.url;
    ejs.renderFile('templates/test.ejs', {
        user: {
            name: '克里斯',
            age: 18
        }
    }, function (err, str) {
        res.end(str)
    });
});
// 监听端口
server.listen(3000, () => console.log('监听到3000端口, http://localhost:3000'));